use Dosvid
go

if exists(select 1
		  from sysobjects
		  where name = 'Candidat_ExceptEmployers')
  drop table Candidat_ExceptEmployers
go

create table Candidat_ExceptEmployers
(
  Id int identity(1,1) not null,
  CandidatID int not null,
  EmployerID int not null
)  
go

alter table Candidat_ExceptEmployers add constraint PK_Candidat_ExceptEmployers_ID primary key(Id) 
go


alter table Candidat_ExceptEmployers add constraint FK_Candidat_ExceptEmployers_Candidates_CandidatID 
      foreign key (CandidatID) references Candidates(Id) on delete cascade
go


alter table Candidat_ExceptEmployers add constraint FK_Candidat_ExceptEmployers_Employers_EmployerID 
      foreign key (EmployerId) references Employers(Id) 
go


create nonclustered index IX_Candidat_ExceptEmployer_CandidatId on Candidat_ExceptEmployers
       (CandidatID asc)
go
